<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="input">
    <!-- 
        event.key 获取键盘按下对应的键
        event.keyCode 获取按下的键的状态码
     -->
    <script>
        var input = document.getElementById("input")
        input.onkeydown = function(event){
            console.log(event.key)
            console.log(event.keyCode);
            if(event.keyCode == 85){
                console.log("发大招");
            }
        }
        input.onkeypress = function(){
            console.log("press");
        }
        input.onkeyup = function(){
            console.log("up");
        }
    </script>
</body>
</html>